package com.wowangz.cms.component.datagrid.pojo;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.wowangz.cms.component.datagrid.utils.DataTypeConstant;
/**
 * 
 * @author leiyang3
 *
 */
public class DataStyle
{
	private long pageIndex = 0;   //页数
	private long dataCount = 0;   //总记录数
	private List dataList = null; //源数据（没有被样式化的）
	private List dataStyleList = new ArrayList(); //Row数据的样式
	private Map sumMap = new HashMap(); //当前页合计

	public long getPageIndex() {
		return pageIndex;
	}

	public void setPageIndex(long pageIndex) {
		this.pageIndex = pageIndex;
	}

	public long getDataCount() {
		return dataCount;
	}

	public void setDataCount(long dataCount) {
		this.dataCount = dataCount;
	}

	public List getDataList() {
		return dataList;
	}

	public void setDataList(List dataList) {
		this.dataList = dataList;
	}

	public List getDataStyleList() {
		return dataStyleList;
	}

	public Map getSumMap() {
		return sumMap;
	}

	public void addDepict(String displayName, long displayType){
		DataDepict dataDepict = new DataDepict();
		dataDepict.setDisplayName(displayName);
		dataDepict.setDisplayType(displayType);
		this.dataStyleList.add(dataDepict);
	}
	
	public void addDepictByFunction(String displayName, Class fnClazz, String fnMethodName,  Class[] fnArgClass){
		DataDepictFunction dataDepict = new DataDepictFunction();
		dataDepict.setDisplayName(displayName);
		dataDepict.setDisplayType(DataTypeConstant.FUNCTION);
		dataDepict.setFnClazz(fnClazz);
		dataDepict.setFnMethodName(fnMethodName);
		dataDepict.setFnArgClass(fnArgClass);
		this.dataStyleList.add(dataDepict);
	}
	
	public void addDepictByCacheMap(String displayName,String mapkey, Class fnClazz, String fnMethodName){
		DataDepictCacheMap dataDepict = new DataDepictCacheMap();
		dataDepict.setDisplayName(displayName);
		dataDepict.setDisplayType(DataTypeConstant.CACHEMAP);
		dataDepict.setMapkey(mapkey);
		dataDepict.setFnClazz(fnClazz);
		dataDepict.setFnMethodName(fnMethodName);
		this.dataStyleList.add(dataDepict);
	}
	
	public void addDepictByDataDictionary(String displayName, String dictCode){
		DataDepictDataDictionary dataDepict = new DataDepictDataDictionary();
		dataDepict.setDisplayName(displayName);
		dataDepict.setDisplayType(DataTypeConstant.DATADICTIONARY);
		dataDepict.setDictCode(dictCode);
		this.dataStyleList.add(dataDepict);
	}
	public void addSum(String displayName, String sumName){
		this.sumMap.put(displayName, sumName);
	}
	

	public void addSum(String displayName, double sumNum){
		this.sumMap.put(displayName, sumNum);
	}
}
